import Sprite = Laya.Sprite;
/**
 * Created by bobo on 2017/5/15.
 */
class UIManager {

    public static broadLayer: View2;
    public static uiLayer: View2;
    public static dialogLayer: View2;
    public static dialogLayer2: View;

    /**
     * 纵横缩放比
     */
    public static ui_scale:number = 1;

    /**
     * ui管理器 初始化
     */
    public static init(): void {
        UIConfig.popupBgAlpha = 0.7;

        this.broadLayer = new View2();
        this.uiLayer = new View2();  //主界面UI
        this.dialogLayer = new View2();
        this.dialogLayer2 = new View();

        Laya.stage.addChild(this.uiLayer);
        Laya.stage.addChild(this.dialogLayer);
        Laya.stage.addChild(this.dialogLayer2);
        this.dialogLayer2.addChild(Dialog.manager);
        Laya.stage.addChild(this.broadLayer);

        this.uiLayer.mouseThrough = true;
        this.dialogLayer.mouseThrough = true;
        this.broadLayer.mouseThrough = true;

        UIManager.onResize();
    }

    /**
     * 舞台大小变更
     */
    public static onResize(): void {
        if (this.uiLayer == null) {
            return;
        }
        UIManager.LayerResize(this.uiLayer);
        UIManager.LayerResize(this.dialogLayer);
        UIManager.LayerResize(this.broadLayer);
    }

    /**
     */
    public static LayerResize(layer: View): void {
        layer.width = StageManager.width;
        layer.height = StageManager.height;
    }
}


